﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace ConsoleApp1.DbCustom.Models
{
    [Index(nameof(UserName), Name = "AK_KEY_2_Sys_User", IsUnique = true)]
    [Index(nameof(UserName), Name = "Index_UserName")]
    public partial class Sys_User
    {
        public Sys_User()
        {
            Blog_Collect = new HashSet<Blog_Collect>();
            Blog_FocusFocusOn = new HashSet<Blog_Focus>();
            Blog_FocusPerson = new HashSet<Blog_Focus>();
            Blog_Info = new HashSet<Blog_Info>();
            Blog_PersonCategory = new HashSet<Blog_PersonCategory>();
            Blog_PersonLabel = new HashSet<Blog_PersonLabel>();
            Sys_UserRole = new HashSet<Sys_UserRole>();
            Sys_User_RefreshToken = new HashSet<Sys_User_RefreshToken>();
        }

        [Key]
        [StringLength(36)]
        [Unicode(false)]
        public string Id { get; set; } = null!;
        /// <summary>
        /// 1 博客
        /// </summary>
        public int Category { get; set; }
        [StringLength(50)]
        public string UserName { get; set; } = null!;
        [StringLength(50)]
        public string? Name { get; set; }
        /// <summary>
        /// 1 男
        ///    2 女
        /// </summary>
        public int? Sex { get; set; }
        [Column(TypeName = "date")]
        public DateTime? Birthdate { get; set; }
        [StringLength(50)]
        public string? Nickname { get; set; }
        [StringLength(20)]
        public string? MobileNo { get; set; }
        [StringLength(50)]
        public string? Email { get; set; }
        [StringLength(200)]
        public string? PersonalImage { get; set; }
        [StringLength(50)]
        public string? Password { get; set; }
        [StringLength(100)]
        public string? Remark { get; set; }
        public bool IsActive { get; set; }
        public int Sort { get; set; }
        [StringLength(36)]
        [Unicode(false)]
        public string? CreatedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? CreatedTime { get; set; }
        [StringLength(36)]
        [Unicode(false)]
        public string? LastModifiedBy { get; set; }
        [Column(TypeName = "datetime")]
        public DateTime? LastModifiedTime { get; set; }

        [InverseProperty("User")]
        public virtual Blog_Personal Blog_Personal { get; set; } = null!;
        [InverseProperty("Collect")]
        public virtual ICollection<Blog_Collect> Blog_Collect { get; set; }
        [InverseProperty(nameof(Blog_Focus.FocusOn))]
        public virtual ICollection<Blog_Focus> Blog_FocusFocusOn { get; set; }
        [InverseProperty(nameof(Blog_Focus.Person))]
        public virtual ICollection<Blog_Focus> Blog_FocusPerson { get; set; }
        [InverseProperty("AuthorNavigation")]
        public virtual ICollection<Blog_Info> Blog_Info { get; set; }
        [InverseProperty("User")]
        public virtual ICollection<Blog_PersonCategory> Blog_PersonCategory { get; set; }
        [InverseProperty("User")]
        public virtual ICollection<Blog_PersonLabel> Blog_PersonLabel { get; set; }
        [InverseProperty("User")]
        public virtual ICollection<Sys_UserRole> Sys_UserRole { get; set; }
        [InverseProperty("User")]
        public virtual ICollection<Sys_User_RefreshToken> Sys_User_RefreshToken { get; set; }
    }
}
